package com.chenfan.process.service.impl;

import org.springframework.stereotype.Service;

import com.chenfan.ccp.util.tool.UuidUtil;
import com.chenfan.process.entity.po.ApprovalPo;
import com.chenfan.process.entity.po.ProcessDetailPo;
import com.chenfan.process.entity.po.ProcessPo;
import com.chenfan.process.entity.po.ProcessRelatedPo;

/**
 * @author liuming
 * @date 2022/1/14
 */
@Service
public class ProcessDetailDomainService {

    public static ProcessDetailPo detailFactory(ApprovalPo approvalPo, ProcessRelatedPo processRelated,
        ProcessPo process) {

        ProcessDetailPo processDetail = ProcessDetailPo.builder().processId(processRelated.getProcessBeforeId())
            .nextProcessId(process.getId()).approvalTemplateId(processRelated.getApprovalTemplateId())
            .parentId(approvalPo.getApprovalId()).build();
        processDetail.setId(UuidUtil.generateId());
        return processDetail;
    }
}
